const joi = require('@hapi/joi')
const password = joi.string().required().pattern(/^[\S]{6,12}$/)

exports.reg_login_schema = {
  body:{
    username: joi.string().alphanum().min(1).max(10).required(),
    password
  }
} 

exports.info_updata_schema = {
  body:{
    id : joi.number().integer().min(1).required(),
    nickname : joi.string().required(),
    email : joi.string().email().required()
  }
}

exports.pwd_updata_schema = {
  body:{
    oldPwd: password,
    newPwd: joi.not(joi.ref('oldPwd')).concat(password)
  }
}

exports.avatar_update_schema = {
  body:{
    avatar: joi.string().dataUri().required()
  }
}